<template>
  <div class="divBox">
    <el-card class="box-card">
      <el-form :model="form" label-width="120px">
        <el-form-item label="热文推荐">
          <el-radio-group v-model="form.hotText">
              <el-radio :label="0">关闭</el-radio>
              <el-radio :label="1">开启</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="名片视频形象">
          <el-radio-group v-model="form.cardVideo">
              <el-radio :label="0">关闭</el-radio>
              <el-radio :label="1">开启</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="企业官网权限">
          <el-radio-group v-model="form.website">
              <el-radio :label="0">关闭</el-radio>
              <el-radio :label="1">开启</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="企业视频">
          <el-radio-group v-model="form.enterpriseVideo">
              <el-radio :label="0">关闭</el-radio>
              <el-radio :label="1">开启</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-button type="primary" @click="submit">提交</el-button>
      </el-form>
    </el-card>
  </div>
</template>
<script>
import {setCard,getCompanyInfo } from "@/api/buss"
export default {
  data() {
    return {
      form:{
        hotText:1,
        cardVideo:1,
        website:1,
        enterpriseVideo:1,
      }
    }
  },
  mounted(){
    getCompanyInfo().then(res=>{
      this.form.hotText = res.data.set_up.hot_switch
      this.form.cardVideo = res.data.set_up.video_switch
      this.form.website = res.data.set_up.web_switch
      this.form.enterpriseVideo = res.data.set_up.qy_video_switch
    })
  },
  methods: {
    // 提交
    submit(){
      setCard({
        hot_switch:this.form.hotText,
        video_switch:this.form.cardVideo,
        web_switch:this.form.website,
        qy_video_switch:this.form.enterpriseVideo
      }).then(res=>{
        this.$message.success(res.message)
      })
    }
  },
};
</script>
<style lang="stylus" scoped>
</style>
